<?php
session_start();
require_once("../includes/user.php"); 
$user=new User;
$p_row=$user->getUserProfile($_SESSION['id']);
?>
<link href="../css/default.css" rel="stylesheet" type="text/css">
<table width="662" height="122" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="662" height="10"><div class="Innerheading"> Your Points</div></td>
  </tr>
  <tr>
    <td><div class="InnerDarkbox">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="37%" align="right" valign="middle" class="head">Name :</td>
          <td width="63%"><span class="profile"><?php echo $p_row['name'] ?></span></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">Year :</td>
          <td><span class="profile"><?php echo $user->getYear($p_row['year']);
			    ?> CSE</span></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">Reg No :</td>
          <td><?php echo $pro_row['regno']; ?></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">House :</td>
          <td><span class="profile"><?php echo $user->getHouse($p_row['house']); ?></span></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">Overall Points :</td>
          <td><?php echo $user->getPoints($p_row['id']); ?> pts</td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td><strong>Contribution:</strong></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td><ul>
            <li>Academic Points (Semester): <?php echo $user->getAcadSemPoints($p_row['id']); ?></li>
          </ul></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td><ul>
            <li>Academic Points (Internal): <?php echo $user->getAcadInterPoints($p_row['id']); ?></li>
          </ul></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td><ul>
            <li>Attendance Points: <?php echo $user->getAttenPoints($p_row['id']); ?></li>
          </ul></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td><ul>
            <li>Extra (Inter) :<?php echo $user->getExtraInterPoints($p_row['id']); ?></li>
          </ul></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td><ul>
            <li>Extra (Intra):<?php echo $user->getExtraIntraPoints($p_row['id']); ?></li>
          </ul></td>
        </tr>
        <tr>
          <td align="right" valign="middle" class="head">&nbsp;</td>
          <td><ul>
            <li>Daily Quiz :<?php echo $user->getQuizPoints($p_row['id']); ?></li>
          </ul></td>
        </tr>
      </table>
    </div></td>
  </tr>
</table>
<p>&nbsp;</p>
<?php
$house_res=mysql_query('select * from house_details where visibility=1 ORDER BY `house_details`.`house_name` ASC');
 ?>
<table width="662" height="76" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="662" height="10"><div class="Innerheading">Housewise Overview</div></td>
  </tr>
  <tr>
    <td height="56"><div class="InnerDarkbox">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="46%" align="center" valign="middle" class="head">House</td>
          <td width="54%" align="center" valign="middle" class="head">Points</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <?php
		while($house_row=mysql_fetch_array($house_res))
		{
		$pts=0;
		$pt=0;
		 ?>
        <tr>
          <td align="center" valign="middle">&nbsp;</td>
          <td align="center" valign="middle">&nbsp;</td>
        </tr>
        <tr>
          <td align="center" valign="middle"><?php echo $house_row['house_name'];
		  $pro_res=mysql_query("select id from user_profile where accept=1 and house='$house_row[house_id]'");
	while($pro_row=mysql_fetch_array($pro_res)){
	$pt=$user->getPoints($pro_row['id']);
	$pts=$pts+$pt;
	} ?></td>
          <td align="center" valign="middle">
        <?php
	
	echo $pts;
		?></td>
        <?php } ?>
        </tr>
      </table>
    </div></td>
  </tr>
</table>
<p>&nbsp;</p>
